/******************************************************************************

    Simple Authentication and Authorisation System (SAAS)

    log.c

    Copyright (C) 2011  Josh Goes


    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    If you require a mailing address for this software, please send your
    mail to the following address:
        SAAS
        GPO Box 2973
        BRISBANE QLD 4001
        AUSTRALIA

******************************************************************************/


#include "saas-build.h"

#include <stdarg.h>
#include <stdio.h>
#include <string.h>


/*
uint16_t saas_set_log( saas_t *inst , uint8_t log_level , uint8_t log_type , int log_fd , pam_handle_t *pamh )
{
	switch ( log_type )
	{
		case SAAS_LOG_NONE:
		case SAAS_LOG_STDOUT:
		case SAAS_LOG_SYSLOG:
			inst->log_type = log_type;
			break;

		case SAAS_LOG_FILE:
			inst->log_type = log_type;
			inst->log_fd   = log_fd;
			break;

		case SAAS_LOG_PAM_SYSLOG:
			inst->log_type = log_type;
			inst->pamh     = pamh;
			break;

		default:
			return SAAS_OP_ARG_ERROR;
	}

	if ( log_level > 7 )
		return SAAS_OP_ARG_ERROR;
	inst->log_level = log_level;

	return SAAS_OP_SUCCESS;
}
*/


char *saaserror( uint16_t  errcode )
{
	switch ( errcode )
	{
		case SAAS_OP_SUCCESS              : return "Successful";

		case SAAS_OP_INVALID_PASS         : return "Invalid Password";
		case SAAS_OP_USER_NOT_FOUND       : return "User Not Found";
		case SAAS_OP_GROUP_NOT_FOUND      : return "Group Not Found";
		case SAAS_OP_USER_UNAUTHORISED    : return "User Unauthorised";
		case SAAS_OP_USERNAME_TOO_LONG    : return "Username Too Long";

		case SAAS_OP_SERVER_ERROR         : return "Server Error";
		case SAAS_OP_NO_HOSTS             : return "No Usable/Contactable Hosts";
		case SAAS_OP_DECRYPT_ERROR        : return "Decrypt Error";
		case SAAS_OP_MAGIC_ERROR          : return "Magic ID Error";
		case SAAS_OP_FILE_ERROR           : return "File Error";
		case SAAS_OP_PAD_ERROR            : return "Padding Error";
		case SAAS_OP_PARSE_ERROR          : return "Parse Error";
		case SAAS_OP_ARG_ERROR            : return "Argument Error";
		case SAAS_OP_MEM_ERROR            : return "Memory Error";
		case SAAS_OP_TIMEOUT_ERROR        : return "Timeout Error";
		case SAAS_OP_SOCKET_ERROR         : return "Socket Error";
		case SAAS_OP_MALFORMED_REQUEST    : return "Malformed Request";
		case SAAS_OP_MALFORMED_RESPONSE   : return "Malformed Response";
	}
	return "Unknown";
}




